﻿<%@ page language="java" import="java.util.*,org.hyy.vo.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>商品分类</title>

	<link href="css/index.css" rel="stylesheet" type="text/css" />
	<link href="css/register.css" rel="stylesheet" type="text/css" />
  </head>
  
  <body>
	<%@include file="../public/head.jsp" %>		
		<div id="hr-body">
		    <div class="hr-body-content">
			   <TABLE class=hr-body-layout width="100%">
				  <TBODY>
				  <TR>
				    <%@include file="../public/adminleft.jsp" %>
				      <TD class=hr-bl-right vAlign=top>
				      	<DIV class=MemberCenterWrap>
				      		<H2>欢迎进入管理菜单->类别列表</H2>
				      		<div class="TableWrap MemberOrderList">
				      			<%List<Category> categories = (List)request.getAttribute("categories");%>
				      			<table  class="list" cellpadding="0" cellspacing="0" width="100%">
									<thead>
									
										<tr>
											<td align="center" width="5%">
												类别编号
											</td>
											<td align="center" width="26%">
												类别名称
											</td>
											<td align="center" width="30%">
												类别描述
											</td>
											<td align="center" width="5%">
												PID
											</td>
											<td align="center" width="10%">
												代表字串
											</td>
											<td align="center" width="5%">
												级别
											</td>
											<td align="center">
												处理
											</td>
										</tr>
										</thead>
										
										<tbody>
						
										<%
										for (int i = 0; i < categories.size(); i++) {
											Category c = (Category)categories.get(i);
											String preStr = "";
												for(int j=1; j<c.getGrade(); j++) {
													preStr += "--";
												}
										%>
											<tr>
												<td align="center">
													<%=c.getId()%>
												</td>
												<td align="left">
													<%=preStr + c.getName()%>
												</td>
												<td align="center">
													<%=c.getDescr()%>
												</td>
												<td align="center">
													<%=c.getPid()%>
												</td>
												<td align="center">
													<%=c.getCno()%>
												</td>
												<td align="right">
													<%=c.getGrade() %>
												</td>
												<td align="right">
													<a target="detail" href="showchangecategory?id=<%=c.getId()%>">修改类别</a>
													<% if(c.getGrade()<Category.MAX_GRADE) { %>
														<a href="showaddcategory?pid=<%=c.getId()%>&grade=<%=c.getGrade()%>">添加子类别</a>
													<% } %>
												</td>
											</tr>
										
										<%
										}
										%>
										</tbody>
									</table>
								</div>
							</TD>
						</TR>
					</TBODY>
				</TABLE>
			</div>
		</div>
     	
		<%@include file="../public/foot.jsp" %>
  </body>
</html>
